{# force compact parts and wide #}
{% for min_bytes_for_wide_part in [100000, 0] %}
DROP TABLE IF EXISTS compact_alter_{{ min_bytes_for_wide_part }};
CREATE TABLE compact_alter_{{ min_bytes_for_wide_part }} (d Date, s String, k UInt64) ENGINE=MergeTree() PARTITION BY d ORDER BY k SETTINGS min_bytes_for_wide_part={{ min_bytes_for_wide_part }};

INSERT INTO compact_alter_{{ min_bytes_for_wide_part }} VALUES ('2015-01-01', '2015-01-01 00:00:00', 10);

ALTER TABLE compact_alter_{{ min_bytes_for_wide_part }} ADD COLUMN n.d Int;
-- force columns creation
OPTIMIZE TABLE compact_alter_{{ min_bytes_for_wide_part }} FINAL;
-- this command will not drop n.d from compact part columns.txt
ALTER TABLE compact_alter_{{ min_bytes_for_wide_part }} DROP COLUMN n;
-- and now modify column will trigger READ_COLUMN of n.d, and it will bail
ALTER TABLE compact_alter_{{ min_bytes_for_wide_part }} MODIFY COLUMN s DateTime('UTC') DEFAULT '1970-01-01 00:00:00';

DROP TABLE compact_alter_{{ min_bytes_for_wide_part }};
{% endfor %}
